var analysisLog = function(log) {
    var arrs = log.split('\n');
    //console.log("arrs",arrs);
    var resArr = [];
    for (var i = 0; i < arrs.length; i++) {
        var row = arrs[i];
        var item = row.split('\t');
        //  console.log("item",item);
        var size = parseInt(item[0]) / 2;
        //BLOCKSIZE  If the environment variable BLOCKSIZE is set, and the -k option is not specified, the block counts will be displayed in units of that size block.  If BLOCKSIZE is not set, and the -k option is not specified, the block counts
        //will be displayed in 512-byte blocks.
        if (size < 1000 || resArr.length > 1000) {
            break;
        }
        var path = item[1];
        if (!path) {
            break;
        }
        var data = {
            size: size,
            mb: size / 1024,
            gb: size / (1024 * 1024),
            path: path,
            showPath: path.replace("./Macintosh HD/", "/")
        };
        //  console.log("data", data);
        if (data.gb > 1) {
            data.show = data.gb.toFixed(3) + " GB";
        } else {
            data.show = data.mb.toFixed(3) + " MB";
        }
        //  console.log(data.show, "\t", data.showPath);
        var dataShow = [data.show, "            ".substr(data.show.length), data.showPath].join("");
        //  console.log("dataShow",dataShow);
        resArr.push(dataShow);
    }
    var res = resArr.join("\n");
    return res;
}
module.exports = analysisLog;
